package com.teamwork.ZuccEcho.Entity;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.util.List;


////模板
//@Entity
//@Table(name = "Model", schema = "", catalog = "")
//public class Model {
//    private long mId;//模板id
//    private String mName;//模板名称
//    private String mIllustration;//模板说明
////    private List<Question> content;//模板内容（即包含的问题）
//
//    @Id
//    @Column(name = "mId")
//    @GeneratedValue(strategy = GenerationType.IDENTITY)
//    public long getmId() {
//        return mId;
//    }
//
//    public void setmId(long mId) {
//        this.mId = mId;
//    }
//
//    @Basic
//    @Column(name = "mName")
//    public String getmName() {
//        return mName;
//    }
//
//    public void setmName(String mName) {
//        this.mName = mName;
//    }
//
//    @Basic
//    @Column(name = "mIllustration")
//    public String getmIllustration() {
//        return mIllustration;
//    }
//
//    public void setmIllustration(String mIllustration) {
//        this.mIllustration = mIllustration;
//    }
//
//    @Override
//    public boolean equals(Object o) {
//        if (this == o) return true;
//        if (o == null || getClass() != o.getClass()) return false;
//        Model that = (Model) o;
//        return mId == that.mId &&
//                Objects.equals(mName, that.mName) &&
//                Objects.equals(mIllustration, that.mIllustration);
//    }
//
//    @Override
//    public int hashCode() {
//        return Objects.hash(mId, mName, mIllustration);
//    }
//}

//模板
@Entity
//@Data
@Setter
@Getter
public class Model {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long m_id;//模板id
    private String m_name;//模板名称
    private String m_illustration;//模板说明

//    @OneToMany()
    @OneToMany(mappedBy="model")
//    @JoinColumn(name="m_id")//在子表中的外键名
    private List<Modelquestion> modelquestionList;

    @ManyToOne
    @JoinColumn(name="tch_id")//在子表中的外键名
    private Teacher teacher;//老师

    @Override
    public String toString() {
        return "Model{" +
                "m_id=" + m_id +
                ", m_name='" + m_name + '\'' +
                ", m_illustration='" + m_illustration + '\'' +
                ", modelquestionList=" + modelquestionList +
                '}';
    }
}